package gxd26.basic;

public class J02_Charge {

	public static void main(String[] args) {
		// 잔돈 계산하는 프로그램
		//int charge = 876543210;
		int charge;
		charge = 876_543_210; // JDK7, 자릿수 구분 _
		int w10;
		int w50;
		int w100;
		int w500;
		int w1000;
		int w5000;
		int w10000;
		int w50000;
		int rest;
		
		System.out.println(charge);
	    w50000 = charge/50000;					// 5만원권 장수
	    rest   = charge - (50000*w50000);		// 5만원 짜리들 뺀 나머지
	    
	    w10000 = rest/10000;
	    rest   = rest - (10000*w10000);
	    
	    w5000  = rest/5000;
	    rest   = rest - (5000*w5000);
	    
	    w1000  = rest/1000;
	    rest   = rest - (1000*w1000);
	    
	    w500   = rest/500;
	    rest   = rest - (500*w500);
	    
	    w100   = rest/100;
	    rest   = rest - (100*w100);
	    
	    w50    = rest/50;
	    rest   = rest - (100*w50);
	    
	    w10	   = rest/10;
	    rest   = rest - (100*w10);
	    
	    System.out.println(w50000);
	    System.out.println(w10000);
	    System.out.println(w5000);
	    System.out.println(w1000);
	    System.out.println(w500);
	    System.out.println(w100);
	    System.out.println(w50);
	    System.out.println(w10);
	        
		
		
		

	}

}
